<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=0.8, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>魏远商城</title>
    <link rel="stylesheet" type="text/css" href="../../css/home/home.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common/public.css" />
    <link rel="stylesheet" type="text/css" href="../../assets/swiper-3.4.2.min.css"/>
    <script src="../../assets/swiper-3.4.2.min.js"></script>
    <script src="../../assets/jquery-3.1.1.min.js"></script>
</head>
<body>
	<div class="top_all">
		<div class="top">
			<div class="top_con">
				<div class="tlogin"></div>
				<div class="gotoregister" style="display: none;">免费注册</div>
				<div class="homepage">商城首页</div>
				<div class="tmyorder">我的订单<img src="../../image/turn_down.png"></div>						
				<div class="home_car"><img src="../../image/shop_car.png">购物车<span class="car_time"></span></div>
				<div class="line_ke">联系客服<img src="../../image/turn_down.png"></div>						
			</div>
		</div>
		<div class="loged" style="display: none;">
			<div><span class="guanli">账号管理</span>|<span class="out">退出</span></div>
			<div class="thead">
				<div class="thead_pic"><span></span></div>
				<div class="tmenber">企业会员</div>
			</div>
		</div>
		<div class="myorder">
			<span class="order_1">待支付</span>
			<span class="order_2">待发货</span>
			<span class="order_3">待收货</span>
			<span class="order_4">待评价</span>
		</div>
		<div class="tcont">
			<span class="mine1">用户帮助</span>
			<span class="mine2">联系客服</span>
			<span class="mine3">投诉建议</span>
			<span class="mine4">退换货</span>
			<span class="mine5">收货地址管理</span>
		</div>
		
		<div class="logeandsear">
			<div class="imageLogo"><img src="../../image/Logo.png"></div>
			<div class="search">
				<div>
					<img class="search-icon" src="../../image/search-icon.png"><input type="text" class="home_searchto" placeholder="魏远产品搜索" /><span class="gotosearch">搜索</span>
				</div>
			</div>
	    </div>
	</div>	
	<div class="right">
		<div class="right_car"><span><img src="../../image/righr_car.png"></br>购</br>物</br>车</span></div>
		<div class="youhuiquan"><span>优</br>惠</br>券</span></div>
		<div class="qianbao"><span>钱</br>包</span></div>
		<div class="qiyeshangc"><span>企</br>业</br>商</br>城</span></div>
		<div class="totop"><span><br/>^<br/>TOP</span></div>
	</div>
	
	<div class="wrap">
		<div class="select">
			<div>
				<span class="alltype">全部商品分类</span>
				<span  class="home_hot">热销爆款</span>
				<span class="home_new">新品速递</span>
				<span class="home_acv">营销活动</span>
				<span class="home_topg">优品馆</span>
				<div class="downtypeg" style="display: none;">
					<div class="downtypegdivall">
						<div class="downtypegdiv"></div>						
						<div class="downcatediv" style="display: none;"></div>						
					</div>
				</div>
			</div>
		</div>
		<div class="banbo">
			<div class="swiper-container banner-swp" style="width: 100%;height: 100%;">
			    <div class="swiper-wrapper swiper-wrapperban">
			        
			    </div>
			    <!-- 如果需要分页器 -->
			    <div class="swiper-pagination"></div>	
			    <div class="swiper-button-prev swiper-button-prevban" style="display:block;background-image: url('../../image/banturnleft.png');width: 88px;height: 168px;background-size: contain;left: 120px;margin-top: -88px;"></div>
			    <div class="swiper-button-next swiper-button-nextban" style="display:none;background-image: url('../../image/banturnright.png');width: 88px;height: 168px;background-size: contain;right: 120px;margin-top: -88px;"></div>
			</div>
		</div>
		<div class="firegoods">
			<div class="firegoods-title"><img src="../../image/leftdian.png">爆款<img src="../../image/rightdian.png"></div>
			<div class="firegoods-con">
				<div class="swiper-container swiper-containerbao" style="width: 100%;">
			        <div class="swiper-wrapper swiper-wrapperbao">
			            
			        </div>
			        
			        
			    </div>
			    <div class="swiper-button-prev swiper-button-prevbao" style="margin:0;display:none;background-image: url('../../image/baoturn_left.png');top: 35%;width: 52px;height: 107px;background-size: contain;left: 20px;"></div>
			    <div class="swiper-button-next swiper-button-nextbao" style="margin:0;display:none;background-image: url('../../image/baoturn_right.png');top: 35%;width: 52px;height: 107px;background-size: contain;right: 20px;"></div>
			   
			</div>
		</div>
		<div class="longspeak">
			<img src="../../image/longspeak.png"  width="100%">
		</div>
		<div class="showgoodstype">
			<!--<div class="showgoodstype1">
				<div class="showgoodtitle1">
					<p>今日特卖</p>
					<p>享品质，爱生活</p>
					<p>查看更多<img src=""></p>
				</div>
				<div class="good_con1">
					<div></div>
					<div class="goods1">
						<div class="g_infor1">
							<div></div>
							<div class="g_mandp">
								<p></p>
								<p>¥<span></span></p>
							</div>
						</div>
						
					</div>
				</div>
			</div>-->
			<!--<div class="showgoodtitle2">
				<div class="showgoodtitle1">
					<p>今日特卖</p>
					<p>享品质，爱生活</p>
					<p>查看更多<img src=""></p>
				</div>
				<div class="good_con2">
					<div class="goodspic2"></div>
					<div class="goods2">
						<div class="goods2-d1">
							<div>
								<div class="goods2_pic"></div>
								<p></p>
								<p>¥<span></span></p>
							</div>
						</div>
						<div class="goods2-d2">
							<div class="goods2_bigpic"></div>
								<p></p>
							<p>¥<span></span></p>
						</div>
						<div class="goods2-d3">
							<div>
								<div class="goods2_pic"></div>
								<p></p>
								<p>¥<span></span></p>
							</div>
						</div>
					</div>
				</div>
			</div>-->
		</div>
		
		<!--<iframe class="h_bottom" marginwidth="0" marginheight="0"  frameboder="0" scrolling="no" width="100%" height="auto" frameborder="0" src="../common/bottom.html"></iframe>--> 
	</div>
    <div class="wrap">
		<div class="wrap_bottom"><img src="../../image/bottom.png"></div>
	</div>
<script type="text/javascript" src="../../js/url.js"></script>
<script>
	   
	   
//	标记
	   
	   
//	   点击出现左右图标
	$('.firegoods-con').on('mouseover',function(){
		$('.swiper-button-prevbao').css('display','block');
		$('.swiper-button-nextbao').css('display','block');
	})
       
    $('.firegoods-con').on('mouseout',function(){
		$('.swiper-button-prevbao').css('display','none');
		$('.swiper-button-nextbao').css('display','none');
	})   
    
    $('.banbo').on('mouseover',function(){
		$('.swiper-button-prevban').css('display','block');
		$('.swiper-button-nextban').css('display','block');
	})
       
    $('.banbo').on('mouseout',function(){
		$('.swiper-button-prevban').css('display','none');
		$('.swiper-button-nextban').css('display','none');
	})
	
	/*图片放大特效*/
	 $('.firegoods-con').on('mouseover','.goodspic',function(){
	 	
	 	  $(this).css({"transform": "scale(1.05, 1.05)","transition": ".3s transform","box-shadow": "0 11px 24px 3px #a9aaaa"})
	 })
	
	$('.firegoods-con').on('mouseout','.goodspic',function(){
	 	  $(this).css({"transform": "scale(1, 1)","box-shadow":"none"})
	 })


//  $('.downtypeg').on('click','span',function(){
////  	alert($(this).attr('id'));
//  	localStorage.wyshopwheretypec = $(this).attr('id');
//  	window.location.href='classifi.html';
////  	alert(localStorage.wyshopwheretypec);
//  })
      
      $('.firegoods-con').on('click','.firegoods-dan', function() {
				whereto($(this).attr('id'));
				
			});
	
	  $('.goods1_2').on('click','.g_infor1', function() {
				whereto($(this).attr('id'));
				
			});
	
	        function whereto(wid){
	        	localStorage.wyshopwhatclass1 = '';
				localStorage.wyshopwhatclass = '';
	        	localStorage.wyshopwheredetails = wid;
	        	window.location.href='../goods/detalis.html';
	        }

//      $('.swiper-slide>img')
         

      
       
         	               
         	               
//      setTimeout(function(){},6000);               
         	               
         	               
	    /*查看跟多*/
	   $('.showgoodstype').on('click','.lookmore',function(){
	   	  
	   	localStorage.wyshopwheremodel = $(this).attr('id');
	   	window.location.href='../home/hometodetails.html';
	   })


       var bamboHeight; 
            getinfor();
			function getinfor() {
//				alert(localStorage.token);
//				alert(ur);
				$.ajax({
						url: ur + '/mobile/index',
						type: 'GET',
						headers: {
							"X-Token": localStorage.token,
						},
						dataType: 'json',
						data: '',
					})
					.done(function(data) {
						
						
						$('.longspeak>img').attr('src',picur + data.result.data[1][0].plImgsrc);
						
						var how = data.result.data[1].length;

						var lunb = data.result.data[0].length;
						for(var i = 1; i < lunb; i++) {
							var div = ('<div class="swiper-slide" id="' + data.result.data[0][i].plUrl + '"><img src=' + picur + data.result.data[0][i].plImgsrc + ' width="100%" alt="" /></div>');
							$('.swiper-wrapperban').append(div);
							
						}
						
						$('.swiper-slide>img')[0].onload = function(){
					         	bamboHeight = $('.banner-swp').css('height');
//					         	alert(bamboHeight);
					        $('.downtypeg').css('height',bamboHeight);
//					         	
					    }

						$(function(){
							var mySwiper1 = new Swiper('.banner-swp', {
								autoplay: 2000,
								speed: 300,
								autoplayDisableOnInteraction: false,
								lazyLoading: true, // 图片懒加载
								paginationType: 'bullets',
								pagination: '.swiper-pagination',
								loop: true,
								nextButton: '.swiper-button-nextban',
						        prevButton: '.swiper-button-prevban'
							})
							
						})

                         
                         if(data.result.data[1].length < 3) {
							var how4 = data.result.data[1].length;
						} else if(data.result.data[1].length >= 3) {
							var how4 = 4;
						}
						for(var i = 1; i < data.result.data[1].length; i++) {
							
							//								console.log(data.result.data[1][i]);
							var div4 = ('<div class="firegoods-dan swiper-slide" id=' + data.result.data[1][i].plUrl + '>'+
								   	   '<div class="goodspic" style="background-image: url(' + picur + data.result.data[1][i].plImgsrc + ');background-position: center;background-repeat: no-repeat;background-size: cover;"></div>'+
								   	   '<p>' + data.result.data[1][i].plName + '</p>'+
								   	   '<p>¥<span>' + data.result.data[1][i].plPrice + '</span></p>'+
								   	   '<div class="home_masgobuy">立即抢购</div>'+
								       '</div>')
							$('.swiper-wrapperbao').append(div4);						
                         }
                        
                        
                        
                        $(function(){
                            swiper = new Swiper('.swiper-containerbao', {					        
						        slidesPerView: 3,
						        paginationClickable: true,
						        spaceBetween: 0,													
								loop: true,				
						        nextButton: '.swiper-button-nextbao',
						        prevButton: '.swiper-button-prevbao'
						    });
                        });
	   
                    
                        var alldal = data.result.data.length;
                        for(var i = 2; i < alldal; i++){
                        	if(i%2 == 0){
                        		var div = ('<div class="showgoodstype1">'+
										'<div class="showgoodtitle1">'+
											'<p>'+data.result.data[i][0].plName+'</p>'+
											'<p class="sharelist">享品质，爱生活</p>'+
											'<p class="lookmore" id="'+i+'">查看更多<img src="../../image/turn-right.png"></p>'+
										'</div>'+
										'<div class="good_con1">'+
											'<div class="home_main_click" id=' + data.result.data[i][0].plUrl + ' style="background-image: url(' + picur + data.result.data[i][0].plImgsrc + ');background-position: center;background-repeat: no-repeat;background-size: cover;"></div>'+
//											'<div class="whited"></div>'+
											'<div><div class="goods1_'+i+' goods1">'+
//												'<div class="g_infor1">'+
//													'<div></div>'+
//													'<div class="g_mandp">'+
//														'<p></p>'+
//														'<p>¥<span></span></p>'+
//													'</div>'+
//												'</div>'+												
											'</div></div>'+
										'</div>'+
									'</div>');
							$('.showgoodstype').append(div);

							if(data.result.data[i].length < 4) {
								var how2 = data.result.data[i].length;
//								alert(how2);
							} else if(data.result.data[i].length >= 4) {
								var how2 = 4;
							}for(var y = 1; y < how2; y++) {
								var divdan = ('<div class="g_infor1" id=' + data.result.data[i][y].plUrl + '>'+
													'<div class="g_infor_pic" style="background-image: url(' + picur + data.result.data[i][y].plImgsrc + ');background-position: center;background-repeat: no-repeat;background-size: cover;"></div>'+
													'<div class="g_mandp">'+
														'<p>' + data.result.data[i][y].plName + '</p>'+
														'<p>¥<span>' + data.result.data[i][y].plPrice + '</span></p>'+
													'</div>'+
												'</div>');
								$('.goods1_'+i+'').append(divdan);
							}
                        	}else if(i%2 != 0){
                        		
                        	if(data.result.data[i].length>1){

                        		var div = ('<div class="showgoodtype2">'+
											'<div class="showgoodtitle1">'+
												'<p>'+data.result.data[i][0].plName+'</p>'+
												'<p class="sharelist">享品质，爱生活</p>'+
												'<p class="lookmore" id="'+i+'">查看更多<img src="../../image/turn-right.png"></p>'+
											'</div>'+
											'<div class="good_con2">'+
												'<div class="goodspic2 home_main_click" id=' + data.result.data[i][0].plUrl + ' style="background-image: url(' + picur + data.result.data[i][0].plImgsrc + ');background-position: center;background-repeat: no-repeat;background-size: cover;"></div>'+
												'<div class="goods2">'+
													'<div class="goods2-d1_'+i+' goods2-d1">'+
//														'<div>'+
//															'<div class="goods2_pic"></div>'+
//															'<p></p>'+
//															'<p>¥<span></span></p>'+
//														'</div>'+
													'</div>'+
													'<div class="goods2-d2" id=' + data.result.data[i][1].plUrl + '>'+
														'<div class="goods2_bigpic" style="background-image: url(' + picur + data.result.data[i][1].plImgsrc + ');background-position: center;background-repeat: no-repeat;background-size: cover;"></div>'+
															'<p>' + data.result.data[i][1].plName + '</p>'+
														'<p class="price_dan">¥<span>' + data.result.data[i][1].plPrice + '</span></p>'+
													'</div>'+
													'<div class="goods2-d3_'+i+' goods2-d3">'+
//														'<div>'+
//															'<div class="goods2_pic"></div>'+
//															'<p></p>'+
//															'<p>¥<span></span></p>'+
//														'</div>'+
													'</div>'+
												'</div>'+
											'</div>'+
										'</div>');
							$('.showgoodstype').append(div);
                            }
                        	if(data.result.data[i].length>2&&data.result.data[i].length<=4){
                        		
	//                      	alert(11);
								for(var y = 2; y < data.result.data[i].length; y++) {
	
									var divdan = ('<div class="goods2_left" id=' + data.result.data[i][y].plUrl + '>'+
														'<div class="goods2_pic" style="background-image: url(' + picur + data.result.data[i][y].plImgsrc + ');background-position: center;background-repeat: no-repeat;background-size: cover;"></div>'+
														'<p>' + data.result.data[i][y].plName + '</p>'+
														'<p class="price_dan">¥<span>' + data.result.data[i][y].plPrice + '</span></p>'+
													'</div>');
									$('.goods2-d1_'+i+'').append(divdan);
							}
							
							}else if(data.result.data[i].length>4){
								
								
								
								for(var y = 2; y < 4; y++) {

								var divdan = ('<div class="goods2_left" id=' + data.result.data[i][y].plUrl + '>'+
													'<div class="goods2_pic" style="background-image: url(' + picur + data.result.data[i][y].plImgsrc + ');background-position: center;background-repeat: no-repeat;background-size: cover;"></div>'+
													'<p>' + data.result.data[i][y].plName + '</p>'+
													'<p class="price_dan">¥<span>' + data.result.data[i][y].plPrice + '</span></p>'+
												'</div>');
								$('.goods2-d1_'+i+'').append(divdan);
							}
                               
                               if(data.result.data[i].length>=6){
                               	 var ttofour = 5;
                               }else if(data.result.data[i].length<6){
                               	var ttofour = data.result.data[i].length;
                               }
								for(var y = 4; y <= ttofour; y++) {
//								console.log(data.result.data[i]);
//								window.aaaa = data.result.data[i]
//								console.log(y);
//								console.log(data.result.data[i].length);
//								console.log((data.result.data[i])[y]);
//								console.log(i);
								var divdan = ('<div class="goods2_left" id=' + data.result.data[i][y].plUrl + '>'+
													'<div class="goods2_pic" style="background-image: url(' + picur + data.result.data[i][y].plImgsrc + ');background-position: center;background-repeat: no-repeat;background-size: cover;"></div>'+
													'<p>' + data.result.data[i][y].plName + '</p>'+
													'<p class="price_dan">¥<span>' + data.result.data[i][y].plPrice + '</span></p>'+
												'</div>');
								$('.goods2-d3_'+i+'').append(divdan);
							}
							}
							
                        	}
                        }
                             
                             var heightpic = $('.g_infor_pic').css('height');
								
								$('.g_infor_pic').css('width',heightpic);  
				
				           
				          
					})
					
			}

            $('.showgoodstype').on('click','.goods2-d2',function(){
            	whereto($(this).attr('id'));
            })

            $('.showgoodstype').on('click','.goods2_left',function(){
            	whereto($(this).attr('id'));
            })

           $('.swiper-wrapper').on('click','.swiper-slide', function() {
				
		        if($(this).attr('id').indexOf('http') < 0) {
					whereto($(this).attr('id'));
				} else if($(this).attr('id').indexOf('http') >= 0) {
					window.location.href=$(this).attr('id');
				}
			});
          
          $('.clas_con').on('click','.clas_con_dan', function() {
				
		        whereto($(this).attr('id'));
			});
			
			$('.showgoodstype').on('click','.g_infor1', function() {
				
		        whereto($(this).attr('id'));
			});
			
			
			$('.showgoodstype').on('click','.home_main_click', function() {
				
		        whereto($(this).attr('id'));
			});
			
		   
		    
		    
//		    $('.alltype, .downtypeg').on('mouseover',function(){
//	             $('.downtypeg').css('display','block');
//	             $('.alltype').css('background-color','#ffc100');
//
//	        });
//
//	        $('.alltype, .downtypeg').on('mouseout',function(){
//	       	      $('.downtypeg').css('display','none');
//	       	      $('.alltype').css('background-color','transparent');
//
//	        });
		    
		    
		    
	
</script>
</body>
</html>